/*     */ package com.newcrm.webapi;
/*     */ 
/*     */ import com.newcrm.exception.NotFoundException;
/*     */ import com.newcrm.util.ParameterUtil;
/*     */ import com.newcrm.util.Util;
/*     */ import com.newcrm.webapi.sub.AddWhiteBoard;
/*     */ import com.newcrm.webapi.sub.ConfirmDestroyWhiteBoard;
/*     */ import com.newcrm.webapi.sub.DeleteWhiteBoard;
/*     */ import com.newcrm.webapi.sub.DeleteWhiteBoardRelation;
/*     */ import com.newcrm.webapi.sub.ListAllWhiteBoard;
/*     */ import com.newcrm.webapi.sub.ListWhiteBoard;
/*     */ import com.newcrm.webapi.sub.LogicDeleteWhiteBoardRelation;
/*     */ import com.newcrm.webapi.sub.ShowNewWhiteBoard;
/*     */ import com.newcrm.webapi.sub.ShowUpdateWhiteBoard;
/*     */ import com.newcrm.webapi.sub.ShowWhiteBoard;
/*     */ import com.newcrm.webapi.sub.UpdateAllWhiteBoardReaded;
/*     */ import com.newcrm.webapi.sub.UpdateWhiteBoard;
/*     */ import com.newcrm.webapi.sub.UploadWhiteBoardImage;
/*     */ import java.io.IOException;
/*     */ import javax.servlet.RequestDispatcher;
/*     */ import javax.servlet.ServletConfig;
/*     */ import javax.servlet.ServletContext;
/*     */ import javax.servlet.ServletException;
/*     */ import javax.servlet.http.HttpServletRequest;
/*     */ import javax.servlet.http.HttpServletResponse;
/*     */ 
/*     */ public class WhiteBoard extends AbstractHttpServlet
/*     */ {
/*     */   public void doGet(HttpServletRequest request, HttpServletResponse response)
/*     */     throws ServletException, IOException
/*     */   {
/*  51 */     if (!checkLogin(request)) {
/*  52 */       super.showLoginPage(request, response);
/*  53 */       return;
/*     */     }
/*  55 */     String url = request.getRequestURI();
/*  56 */     String[] param = ParameterUtil.getParameters(url, getTagkey());
/*     */     try {
/*  58 */       String operation = Util.getURLParameter(request
/*  59 */         .getParameter("operation"));
/*  60 */       if (((param == null) || (param.length == 0)) && (
/*  61 */         (operation == null) || (operation.trim().length() == 0))) {
/*  62 */         new ListWhiteBoard(this).parse(request, response);
/*  63 */         return;
/*     */       }
/*     */ 
/*  67 */       if ((param != null) && (param.length == 1))
/*     */       {
/*  69 */         if ("search".equals(param[0])) {
/*  70 */           new ListAllWhiteBoard(this).parse(request, response);
/*  71 */           return;
/*     */         }
/*     */ 
/*  75 */         if ("logicDelete".equals(param[0])) {
/*  76 */           new LogicDeleteWhiteBoardRelation(this).parse(request, 
/*  77 */             response);
/*  78 */           return;
/*     */         }
/*     */ 
/*  81 */         if ("deleteRelation".equals(param[0])) {
/*  82 */           new DeleteWhiteBoardRelation(this).parse(request, response);
/*  83 */           return;
/*     */         }
/*     */ 
/*  87 */         if ("readed".equals(param[0])) {
/*  88 */           new UpdateAllWhiteBoardReaded(this)
/*  89 */             .parse(request, response);
/*  90 */           return;
/*     */         }
/*     */       }
/*     */     }
/*     */     catch (NotFoundException e) {
/*  95 */       request.getRequestDispatcher("/nopermission.jsp").forward(
/*  96 */         request, response);
/*  97 */       return;
/*     */     }
/*  99 */     super.doGet(request, response);
/*     */   }
/*     */ 
/*     */   public void doPost(HttpServletRequest request, HttpServletResponse response)
/*     */     throws ServletException, IOException
/*     */   {
/* 116 */     if (!checkLogin(request)) {
/* 117 */       super.showLoginPage(request, response);
/* 118 */       return;
/*     */     }
/* 120 */     String url = request.getRequestURI();
/* 121 */     String[] param = ParameterUtil.getParameters(url, getTagkey());
/*     */     try {
/* 123 */       if ((param != null) && (param.length == 1))
/*     */       {
/* 125 */         if ("uploadImage".equals(param[0])) {
/* 126 */           String path = getServletConfig().getServletContext()
/* 127 */             .getRealPath("images/upload/whiteboard/");
/*     */ 
/* 129 */           new UploadWhiteBoardImage(this, path).parse(request, 
/* 130 */             response);
/*     */ 
/* 132 */           return;
/*     */         }
/*     */       }
/*     */     } catch (NotFoundException e) {
/* 136 */       request.getRequestDispatcher("/nopermission.jsp").forward(
/* 137 */         request, response);
/* 138 */       return;
/*     */     }
/*     */ 
/* 141 */     super.doPost(request, response);
/*     */   }
/*     */ 
/*     */   protected AbstractAction getAddAction()
/*     */   {
/* 146 */     return new AddWhiteBoard(this);
/*     */   }
/*     */ 
/*     */   protected AbstractAction getDeleteAction(String id)
/*     */   {
/* 151 */     return new DeleteWhiteBoard(this, id);
/*     */   }
/*     */ 
/*     */   protected AbstractAction getListAction()
/*     */   {
/* 156 */     return new ListWhiteBoard(this);
/*     */   }
/*     */ 
/*     */   protected AbstractAction getShowAction(String id)
/*     */   {
/* 161 */     return new ShowWhiteBoard(this, id);
/*     */   }
/*     */ 
/*     */   protected AbstractAction getShowAddPageAction()
/*     */   {
/* 166 */     return new ShowNewWhiteBoard(this);
/*     */   }
/*     */ 
/*     */   protected AbstractAction getShowConfirmDestroyAction(String id)
/*     */   {
/* 171 */     return new ConfirmDestroyWhiteBoard(this, id);
/*     */   }
/*     */ 
/*     */   protected AbstractAction getShowUpdatePageAction(String id)
/*     */   {
/* 176 */     return new ShowUpdateWhiteBoard(this, id);
/*     */   }
/*     */ 
/*     */   protected String getTagkey()
/*     */   {
/* 181 */     return "/whiteboard";
/*     */   }
/*     */ 
/*     */   protected AbstractAction getUpdateAction(String id)
/*     */   {
/* 186 */     return new UpdateWhiteBoard(this, id);
/*     */   }
/*     */ }

/* Location:           C:\E\referenceProject\CRM参考\qikebao\WEB-INF\lib\qikebao.jar
 * Qualified Name:     com.newcrm.webapi.WhiteBoard
 * JD-Core Version:    0.6.1
 */